package com.example.nutritionmate.entity;

import javax.persistence.*;

@Entity
@Table(name = "meal_nutrition")
public class MealNutrition {

    @EmbeddedId
    private MealNutritionId id = new MealNutritionId();

    @ManyToOne(fetch = FetchType.LAZY)
    @MapsId("recordId")
    @JoinColumn(name = "record_id")
    private MealRecord mealRecord;

    @ManyToOne(fetch = FetchType.LAZY)
    @MapsId("nutritionId")
    @JoinColumn(name = "nutrition_id")
    private NutritionFact nutritionFact;

    private Double amount;

    public MealNutritionId getId() {
        return id;
    }

    public void setId(MealNutritionId id) {
        this.id = id;
    }

    public MealRecord getMealRecord() {
        return mealRecord;
    }

    public void setMealRecord(MealRecord mealRecord) {
        this.mealRecord = mealRecord;
    }

    public NutritionFact getNutritionFact() {
        return nutritionFact;
    }

    public void setNutritionFact(NutritionFact nutritionFact) {
        this.nutritionFact = nutritionFact;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }
}
